<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
    	<title>录入学生信息</title>
    	<meta name="keywords" content="学生,信息,管理,系统">
		<meta name="description" content="学生信息管理系统">
    	<%@ include file="../public/head.jspf"%>
    	<style type="text/css">
			input[type='text'], textarea{width:90%;}
			label[class='btn']{margin:0 10px;padding:5px;}
		</style>
    	<script type="text/javascript">
			function validate() {
				var id = document.forms[0].id.value;
				var name = document.forms[0].name.value;
				var age = document.forms[0].age.value;
				var major = document.forms[0].major.value;
				if (id <= 0) {
					alert("学号不能为空，请输入学号！");
					return false;
				} else if (name.length <= 0) {
					alert("姓名不能为空，请输入姓名！");
					return false;
				} else if (age <= 0) {
					alert("请输入合法年龄！");
					return false;
				}
				else if (major.length <= 0) {
					alert("专业不能为空，请输入所学专业！");
					return false;
				}
				else
					return true;
			}
		</script>
	</head>
	<body>
		<div class="box">
			<h1>学生信息管理系统<a class="back">返回</a></h1>
			<div class="content">
				<div id="data">
					<form action="students" method="post" id="form" onSubmit="return validate()" >
						<table id="datalist">
							<caption>学生信息输入<input type="hidden" name="methodName" value="0"/></caption>
							<tr>
								<td>学号：</td>
								<td><input type="text" name="id" class="{required:true}" title="学号必须为数字" /></td>
							</tr>
							<tr>
								<td>姓名：</td>
								<td><input type="text" name="name" title="姓名不能为空" /></td>
							</tr>
							<tr>
								<td>年龄：</td>
								<td><input type="text" name="age" title="年龄必须为数字" /></td>
							</tr>
							<tr>
								<td>性别：</td>
								<td>
									<label class="btn"><input type="radio" name="gender" value="男" />男</label>
									<label class="btn"><input type="radio" name="gender" value="女" />女</label>
								</td>
							</tr>
							<tr>
								<td>专业：</td>
								<td><input type="text" name="major" title="专业不能为空" /></td>
							</tr>
							<tr>
								<td colspan="2">
									<input type="submit" class="btn green" value="提交" />
									<input type="button" class="btn blue" value="查看列表"
										onclick="location.href='students?methodName=1'" />
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
	</body>
</html>